package com.thoughtful.loadbalance.loadbalancer;

import java.util.List;
import java.util.Random;

import com.thoughtful.loadbalance.AbstractLoadBalance;
import com.thoughtful.remoting.dto.RpcRequest;

/**
 * @author yushun
 * @createTime 2022/10/19 - 17:04
 **/
public class RandomLoadBalance extends AbstractLoadBalance {

    @Override
    protected String doSelect(List<String> serviceAddress, RpcRequest rpcRequest) {
        Random random = new Random();
        return serviceAddress.get(random.nextInt(serviceAddress.size()));
    }
}
